package com.companion.companion.controller;

import java.util.List;

import com.companion.companion.domain.Carerequest;
import com.companion.companion.service.ICarerequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 用户陪护需求Controller
 * 
 * @author zly
 * @date 2025-05-06
 */@CrossOrigin
@RestController
@RequestMapping("/system/carerequest")
public class CarerequestController
{
    @Autowired
    private ICarerequestService carerequestService;

    /**
     * 查询用户陪护需求列表
     */
    @GetMapping("/list")
    public List<Carerequest> list(Carerequest carerequest)
    {
        return carerequestService.selectCarerequestList(carerequest);
    }

    /**
     * 获取用户陪护需求详细信息
     */
    @GetMapping(value = "/{requestId}")
    public Carerequest getInfo(@PathVariable("requestId") Long requestId)
    {
        return carerequestService.selectCarerequestByRequestId(requestId);
    }

    /**
     * 新增用户陪护需求
     */
    @PostMapping
    public int add(@RequestBody Carerequest carerequest)
    {
        return carerequestService.insertCarerequest(carerequest);
    }

    /**
     * 修改用户陪护需求
     */
    @PutMapping
    public int edit(@RequestBody Carerequest carerequest)
    {
        return carerequestService.updateCarerequest(carerequest);
    }

    /**
     * 删除用户陪护需求
     */
    @DeleteMapping("/{requestIds}")
    public int remove(@PathVariable Long[] requestIds)
    {
        return carerequestService.deleteCarerequestByRequestIds(requestIds);
    }
}
